package staticproxy;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: fzykd
 * Date: 2023-05-11
 * Time: 17:38
 */

//代理对象 静态代理
public class TeacherDaoProxy implements ITeacherDao{

    private ITeacherDao target;//目标对象 通过接口来聚合

    //构造器
    public TeacherDaoProxy(ITeacherDao target) {
        this.target = target;
    }

    @Override
    public void teach() {
        System.out.println("代理开始.........");
        //在代理的时候 可以写额外的代码
        target.teach();
        System.out.println("提交.........");
    }
}
